home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 November / PCWorld_2006-11_cd.bin / domacnost a kancelar / easytime / ETT.exe / reports / xslt / SummaryInvoiceGroupByTask.xsl < prev    next >
Extensible Markup Language  |  2006-08-18  |  5KB  |  158 lines

  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" indent="yes"/>
  4.     <xsl:template match="/">
  5.         <html>
  6.             <head>
  7.                 <link rel="stylesheet" type="text/css" href="style.css"></link>
  8.             </head>
  9.             <xsl:apply-templates select="/Report/HeaderInfo"></xsl:apply-templates>
  10.           <xsl:apply-templates select="/Report/Customer"></xsl:apply-templates>
  11.           <xsl:apply-templates select="/Report/Customer/Project" mode="customer-project"/>
  12.           <xsl:apply-templates select="/Report/Customer/Tax"></xsl:apply-templates>
  13.           <xsl:apply-templates select="/Report/Customer/Total"/>
  14.         </html>
  15.     </xsl:template>
  16.  
  17.     <xsl:template match="HeaderInfo">
  18.        <table class="TableSB" align="center" width="70%">
  19.      <tr>
  20.         <td class="TableSB">
  21.             <table class="TableSB" width="100%" cellpadding="2" cellspacing="0" >
  22.             <tr>
  23.                    <td colspan="2" align="center" class="ReportTitleClass">Invoice# <xsl:value-of select="InvoiceNumber"/></td>
  24.            </tr>
  25.            <xsl:if test="Date">
  26.            <tr>
  27.                    <td colspan="2" align="center" class="Date"><xsl:value-of select="Date/From"/> - <xsl:value-of select="Date/To"/></td>
  28.            </tr>
  29.           </xsl:if>
  30.        </table>    
  31.      </td>
  32.      </tr>
  33.       </table>
  34.    </xsl:template>
  35.    
  36.    <xsl:template match="/Report/Customer/Tax">
  37.     <table style="TableSB" width="70%" align="center">
  38.         <tr>
  39.             <td width="60%" class="SubTotal">Tax (<xsl:value-of select="Percent"/>%)</td>
  40.             <td width="40%" class="DetailRowDataClass1"><xsl:value-of select="Value"/></td>
  41.         </tr>
  42.     </table>
  43.     </xsl:template>
  44.    
  45.    <xsl:template match="/Report/Customer/Total">
  46.     <table style="TableSB" width="70%" align="center">
  47.     <tr>
  48.         <td width="60%" class="Total">Total:</td>
  49.         <td class="Total"><xsl:value-of select="text()"/></td>
  50.     </tr>
  51.     </table>
  52.    </xsl:template>
  53.  
  54.    <xsl:template match="Projects/Project">
  55.        <xsl:value-of select="text()"/>
  56.         <xsl:if test="following-sibling::*/text()">, </xsl:if>
  57.    </xsl:template>
  58.  
  59.    <xsl:template match="Tasks/Task">
  60.     <xsl:value-of select="text()"/>
  61.         <xsl:if test="following-sibling::*/text()">, </xsl:if>
  62.    </xsl:template>
  63.  
  64.    <xsl:template match="Customer">
  65.         <table align="center" width="70%">
  66.             <tr>
  67.                 <td  class="DetailRowTitleClass">Bill to:</td>
  68.             </tr>
  69.             <tr>
  70.                 <td class="DetailRowDataClass"><xsl:value-of select="Name"/></td>
  71.             </tr>
  72.     <xsl:if test="Address">
  73.        <tr>
  74.          <td class="DetailRowDataClass" width="100%"><xsl:value-of select="Address"/> </td>
  75.        </tr>
  76.      </xsl:if>
  77.     <xsl:if test="Address2">
  78.        <tr>
  79.          <td class="DetailRowDataClass" width="100%"><xsl:value-of select="Address2"/> </td>
  80.        </tr>
  81.      </xsl:if>
  82.      <xsl:if test="City">
  83.        <tr>
  84.          <td class="DetailRowDataClass" width="100%"><xsl:value-of select="City"/></td>
  85.        </tr>
  86.      </xsl:if>
  87.      <xsl:if test="State">
  88.        <tr>
  89.          <td class="DetailRowDataClass" width="100%">
  90.            <xsl:value-of select="State"/>
  91.          </td>
  92.        </tr>
  93.      </xsl:if>
  94.      <xsl:if test="Country">
  95.        <tr>
  96.          <td class="DetailRowDataClass" width="100%"> <xsl:value-of select="Country"/>
  97.          </td>
  98.        </tr>
  99.      </xsl:if>
  100.      <xsl:if test="Zip">
  101.        <tr>
  102.          <td class="DetailRowDataClass" width="100%">
  103.            <xsl:value-of select="Zip"/>
  104.          </td>
  105.        </tr>
  106.      </xsl:if>
  107.      <xsl:if test="Phone">
  108.        <tr>
  109.          <td class="DetailRowDataClass" width="100%">
  110.            <xsl:value-of select="Phone"/>
  111.          </td>
  112.        </tr>
  113.      </xsl:if>
  114.      <xsl:if test="Fax">
  115.        <tr>
  116.          <td class="DetailRowDataClass" width="100%"> <xsl:value-of select="Fax"/>
  117.          </td>
  118.        </tr>
  119.      </xsl:if>
  120.             <xsl:if test="//Report/HeaderInfo/Terms">
  121.             <tr>
  122.                 <td class="DetailRowTitleClass">Terms:</td>
  123.                 <td class="DetailRowDataClass"><xsl:value-of select="//Report/HeaderInfo/Terms"/></td>
  124.             </tr>
  125.             </xsl:if>
  126.         </table>
  127.   </xsl:template>
  128.         
  129.     <xsl:template match="Project" mode="customer-project">
  130.         <xsl:if test="Task">
  131.             <table align="center" width="70%">
  132.             <tr>
  133.                 <td class="ProjectName" colspan="3"><xsl:value-of select="@Name"/> :
  134.                 <xsl:value-of select="//HeaderInfo/Date/From"/> - <xsl:value-of select="//HeaderInfo/Date/To"/></td>
  135.             </tr>
  136.             <tr>
  137.                 <td width="60%" class="DetailRowTitleClassCenter">Task</td>
  138.                 <td width="20%" class="DetailRowTitleClassCenter">Hours</td>
  139.                 <td width="20%" class="DetailRowTitleClass">Amount</td>
  140.             </tr>
  141.             <xsl:apply-templates select="Task" mode="customer-task"/>
  142.             <tr>
  143.                 <td width="60%" valign="top" class="SubTotal">Sub-total: </td>
  144.                 <td valign="top" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Hours"/></td>
  145.                 <td valign="top" class="DetailRowDataClass1"><xsl:value-of select="SubTotal/@Amount"/></td>
  146.             </tr>
  147.         </table>
  148.         </xsl:if>
  149.     </xsl:template>    
  150.     
  151.     <xsl:template match="Project/Task" mode="customer-task">
  152.         <tr>
  153.             <td width="60%" class="DetailRowDataClass"><xsl:value-of select="@Name"/></td>
  154.             <td class="DetailRowDataClass1"><xsl:value-of select="@Hours"/></td>
  155.             <td class="DetailRowDataClass1"><xsl:value-of select="@Amount"/></td>
  156.         </tr>
  157.     </xsl:template>
  158. </xsl:stylesheet>